const express = require('express');
const AccountAction = require('../../action/accountAction');
let router = express.Router();


router.post('/login', function (req, res) {
    AccountAction.login(req.body)
        .then(function (result) {
            req.session.account = result.Account;
            return '登录成功';
        })
        .then(res.res, res.rej);
});
router.post('/update', function (req, res) {
    AccountAction.update(req.body).then(res.res, res.rej);
});
router.post('/logout', function (req, res) {
    delete req.session.account;
    res.res();
});


module.exports = router;